package com.wuliang.blog.controller;

import com.wuliang.blog.core.basic.BaseController;
import com.wuliang.blog.core.basic.BaseVo;
import com.wuliang.blog.entities.Article;
import com.wuliang.blog.repositories.ArticleRepository;
import com.wuliang.blog.response.Result;
import com.wuliang.blog.response.ResultUtil;
import com.wuliang.blog.vo.ArticleVo;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author WuLiang
 */
@RestController
@RequestMapping("/article")
@Api(value = "文章")
public class ArticleController extends BaseController<Article, ArticleVo> {

    @Autowired
    private ArticleRepository articleRepository;

    @GetMapping("/getClassifyCount")
    public Result<Object> getClassifyCount() {
        return ResultUtil.success(articleRepository.getCountGroupByClassification());
    }

    @Override
    public Result<Object> save(ArticleVo vo) {
        return null;
    }
}
